// import router from '../index'
import { router } from "@/router"

import { ElMessage } from "element-plus"

import Pace from "pace-js"
import store from "@/store"
import { userStore } from "@/store/modules/user"

export const initAgent = () => {
  const rmleng = Object.keys(store.webConfig.resourceMain).length
  if (rmleng === 0 && store.userStore.token) {
    // const webConfig = webConfig()
    // webConfig.FlushWebConfigMain();

    // (async () => {
    //   const wcfc = await store.webConfig.FlushWebConfigMain()
    // })()
    store.webConfig.FlushWebConfigMain()
    /*if (store.userStore.token) {
      if (store.userStore.user.username == null || store.userStore.user.username === "") {
        store.dispatch("GetInfo").then((res) => {
          store.dispatch("ConnectUserSocket").then(r => console.log(r))
          Pace.stop()
        }).catch(err => {
          ElMessage.error(err)
        })
      }
    }*/

    // if(store.agentSettings.loadingStateConfig){
    //   store.userSocket.ConnectUserSocket()
    //   Pace.stop()
    // }
  }
}

